﻿@using Newtouch.Common.Operator;
@{
    ViewBag.Title = "费用详细信息";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        $('#LevelCode').newtouchBindSelect({
            datasource: function () {
                var resultObjArr = new Array();
                if (top.clients.itemDetails) {
                    $.each(top.clients.itemDetails, function (idx, val) {
                        if (val.Type === "BedGrade") {
                            $.each(val.Items, function (key, value) {
                                $('#LevelCode').append('<option value="' + value.Code + '">' + value.Name + '</option>');
                            });
                        }
                    });
                }
                return resultObjArr;
            }
        });

        if (!!keyValue) {
            $.najax({
                type: "POST",
                async: false,
                url: "@Url.Action("GetFormJson")",
                data: { keyValue: keyValue },
                dataType: "json",
                cache: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    if (data.LevelCode) {
                        $('#LevelCode').val(data.LevelCode);
                    }
                }
            });
        }

        //项目浮层
        $('#sfxmmc').sfxmFloatingSelector({
            djDecimalPlaces: 4,
            showdwjls: true,
            leftshift: 10,
            width: 650,
            ajaxparameters: function ($thisinput) {
                return "mzzybz=1&dllb=2&keyword=" + $.trim($thisinput.val());
            },
            itemdbclickhandler: function ($thistr) {
                $('#sfxmmc').val($thistr.attr('data-sfxmmc'));
                $('#sfxmCode').val($thistr.attr('data-sfxmcode'));
            },
        });
    });

    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        var data = $("#form1").formSerialize();
        $.submitForm({
            url: "/NurseManage/BedLevelCharge/SubmitForm?keyValue=" + keyValue,
            param: data,
            success: function () {
                $.currentWindow().$('#gridList').jqGrid("clearGridData"); //清除明细的grid
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
                $.loading(false);
            }
        });
    }


    function validate() {

    }
    var Editing_ysList = [];

    function staffTreeCallback(treeSeleData) {
        var zlsNames = "";
        Editing_ysList = [];
        $.each(treeSeleData, function () {
            zlsNames += this.text + ",";
            Editing_ysList.push({ id: this.id, gh: this.value, Name: this.text, ks: this.Ex1, ksmc: this.Ex2 });
        })
        if (zlsNames.length > 0) {
            zlsNames = zlsNames.substring(0, zlsNames.length - 1);
        }
        $('#sfxmList').val(zlsNames);
        top.top.window.frames['SFXMSelect'].$.modalClose();   //关闭之
    }
</script>
<form id="form1">
    <div class="tab-content">
        <div role="tabpanel" id="divPatInfo" class="tab-pane fade in active" style="padding-top: 20px; margin-right: 30px;">
            <table class="form" style="margin-top: 10px; width: 95%">
                <tr>
                    <th class="formTitle"><span class="required">*</span>收费项目：</th>
                    <td class="formValue" colspan="5">
                        <input type="text" class="form-control form-an" id="sfxmmc" required />
                        <input type="hidden" class="form-control" id="sfxmCode" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle"><span class="required">*</span>数量：</th>
                    <td class="formValue">
                        <input type="text" class="form-control form-an" id="sl" required />
                    </td>
                    <th class="formTitle">有效</th>
                    <td class="formValue">
                        <div class="ckbox">
                            <input id="zt" type="checkbox" checked="checked"><label for="zt"></label>
                        </div>
                    <th class="formTitle"><span class="required">*</span>等级：</th>
                    <td class="formValue formDdlSelectorTd" style="width:110px !important">
                        <select class="form-control" id="LevelCode">
                        </select>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
